<template>
  <form>
      <div>
        <div class="md-layout-item md-size-100 text-right" style="margin-bottom:20px;">
          <md-button class="md-raised md-success" v-on:click="doSave">保存</md-button>
          <md-button class="md-raised md-success" v-on:click="doSubmit" type="submit">提交</md-button>
        </div>
        <base-edit data-background-color="green" :formdata="baseinfo" :fininstid="fininstid"></base-edit>
        <customer-edit data-background-color="green" :formdata="customerinfo"></customer-edit>
        <cautioner-edit data-background-color="green" :formdata="cautionerinfo"></cautioner-edit>
        <emergency-edit data-background-color="green" :formdata="emergencyinfo"></emergency-edit>
      </div>
  </form>
</template>

<script>

import BaseEdit from '@/views/Common/BaseEdit.vue'
import CustomerEdit from '@/views/Common/CustomerEdit.vue'
import CautionerEdit from '@/views/Common/CautionerEdit.vue'
import EmergencyEdit from '@/views/Common/EmergencyEdit.vue'
import validator from '@/utils/validator'

export default{
  props: {
    fininstid: ''
  },
  components: {
    'base-edit': BaseEdit,
    'customer-edit': CustomerEdit,
    'cautioner-edit': CautionerEdit,
    'emergency-edit': EmergencyEdit
  },
  data () {
    return {
      applycd: '',
      baseinfo: {},
      customerinfo: {},
      cautionerinfo: {},
      emergencyinfo: {}
    }
  },
  mounted: function () {

  },
  methods: {
    doSave: function () {
      var chkflg = validator.saveCheck(this.baseinfo)
      if (chkflg) {
        this.$store.dispatch('onShowmsg', {type: 1, text: '保存成功'})
      }
    },
    doSubmit: function () {
      // console.log(this.$root.mycode.getMList('29'))
      // vali.test()
      // alert(this.formdata.finOfferDealer)
      this.$store.dispatch('onShowmsg', {type: 2, text: '提交失败'})
    }
  }
}
</script>
